<html>

<body>
    <script type="text/javascript">
        function A() {
            this.do = function () { return 'foo'; };
        }

        A.prototype = function () {
            this.do = function () { return 'bar' };
        };
        // 只有实例对象上不存在的属性和方法才会去原型上查找
        var x = new A().do();


        let obj = {
            num1: 117
        }
        debugger
        let res = obj;
        obj.child = obj = { num2: 935 };
        var x = y = res.child.num2;
        console.log(obj.child);
        console.log(res.num1);
        console.log(y);

    </script>
</body>

</html>